package org.desktop.web.client.custom.widget;

import java.util.HashMap;
import java.util.Map;

import com.sencha.gxt.widget.core.client.Window;

public abstract class AbstractWindow extends Window{

	private boolean open = false;
	
	private static Map<String,AbstractWindow> windowsOpened = new HashMap<String, AbstractWindow>();
	
	public abstract String id();

	public AbstractWindow() {
		super();
		this.setMaximizable(true);
		this.setMinimizable(true);
	
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		open = windowsOpened.containsKey(id());
		if(!open){
			windowsOpened.put(id(), this);
			open=true;
			super.show();
		}
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub
		if(open){
			open=false;
			windowsOpened.remove(id());
			super.hide();
			
		}
	}
	
	
}
